
<!DOCTYPE html>
<html>

<!-- Head -->
<head>

	<title>登录表单</title>

	<!-- Meta-Tags -->
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

		<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<!-- //Meta-Tags -->

	<!-- Style --> <link rel="stylesheet" href="css/style.css" type="text/css" media="all">



</head>
<!-- //Head -->

<!-- Body -->
<body>


<script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
	<h1>JK-PAY</h1>


	<div class="container w3layouts agileits">

		<div class="login w3layouts agileits">
			<h2>登 录</h2>
			<form  method="post" id="loginForm">
				<span id="numberFlag"><font color='red'></font></span>
				<input type="text" Name="userNumber" id="userNumber" placeholder="用户名" onblur="cleSpan()" required="">
				<span id="passFlag"></span>
				<input type="password" Name="userPwd" id="userPwd" placeholder="密码"   onblur="cleSpan()" required="">
			</form>
			<ul class="tick w3layouts agileits">
				<li>
					<input type="checkbox" id="brand1" value="">
					<label for="brand1"><span></span>忘记我</label>
				</li>
			</ul>
			<div class="send-button w3layouts agileits">
				<form>
					<input type="button"  value="登 录"  onclick="login()" id="loginButton">
				</form>
			</div>



			<a href="#">记住密码?</a>
			<div class="social-icons w3layouts agileits">
				<p>- 其他方式登录 -</p>
				<ul>
					<li class="qq"><a href="#">
					<span class="icons w3layouts agileits"></span>
					<span class="text w3layouts agileits">QQ</span></a></li>
					<li class="weixin w3ls"><a href="#">
					<span class="icons w3layouts"></span>
					<span class="text w3layouts agileits">微信</span></a></li>
					<li class="weibo aits"><a href="#">
					<span class="icons agileits"></span>
					<span class="text w3layouts agileits">微博</span></a></li>
					<div class="clear"> </div>
				</ul>
			</div>
			<div class="clear"></div>
		</div><div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >企业网站模板</a></div>
		<div class="register w3layouts agileits">
			<h2><span id="regTitileSpan">注 册</span></h2>
			<span id="checkTitle"> </span><br>
			<div class="send-button w3layouts agileits">
				<form>
					<input type="button" value="个人注册" onclick="toRegViewOrCheckPhone()" id="userButton">
				</form>
			</div>

			<div class="send-button w3layouts agileits">
				<form>
					<input type="button" value="企业注册" onclick="toEnterRegViewOrCheckFace()" id="enterButton">
				</form>
			</div>
			<div class="clear"></div>
		</div>
		<div class="clear"></div>

	</div>

	<div class="footer w3layouts agileits">
		<p>Copyright &copy; More Sys <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">不挨门口小组</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">jk-pay</a></p>
	</div>


<script>


    function ale() {
        alert();
    }

    function cleSpan(){
        $("#numberFlag").html("<font color='red'></font>")
        $("#passFlag").html("<font color='red'></font>")
    }
    var shopping = document.getElementById("loginButton");
    var userButton = document.getElementById("userButton");
    var enterButton = document.getElementById("enterButton");
    function login(){

        shopping.setAttribute("value","登录中。。。");

        if($("#userNumber").val()==null||$("#userNumber").val()==""){
            $("#numberFlag").html("<font color='red'>*账号不能为空</font>")
            $("#passFlag").html("<font color='red'></font>")
            shopping.setAttribute("value","登录");
        }else if($("#userPwd").val()==null||$("#userPwd").val()==""){
            $("#numberFlag").html("<font color='red'></font>")
            $("#passFlag").html("<font color='red'>*密码不能为空</font>")
            shopping.setAttribute("value","登录");
        }else{
            $.ajax({
                url:"http://127.0.0.1:8061/LogAndReg/userLog.do",
                type : "post",
                data : $("#loginForm").serialize(),
                dataType : "json",
                success : function(aa) {
                    if (aa.e== 4) {    //登陆成功
                        ifDetails(aa);
                    } else if (aa.e == 2) {   //密码错误
                        $("#numberFlag").html("<font color='red'></font>")
                        $("#passFlag").html("<font color='red'>密码错误！</font>")
                        shopping.setAttribute("value","登录");
                    }else if(aa.e == 3){            //登陆成功，登陆Ip为陌生Ip,需进行安全验证
                        shopping.setAttribute("value","请于右侧面板操作。。。");
                        $("#regTitileSpan").html("<font color='red'>验 证</font>")
                        $("#checkTitle").html("<font color='red'>系统检测到您在不常用设备上登陆账号，需验证账号安全，请选择验证方式....</font>")
                        userButton.setAttribute("value","短信验证");
                        enterButton.setAttribute("value","人脸识别");
                        /*ifDetails(aa);*/
                    }else if (aa.e == 1) {
                        $("#numberFlag").html(
                            "<font color='red'>用户不存在！</font>")
                        $("#passFlag").html("<font color='red'></font>")
                        shopping.setAttribute("value","登录");
                    }
                },
                error : function() {
                    alert("系统错误，请联系管理员！！！");
                    shopping.setAttribute("value","登录");
                }
            })
        }
    }
    function ifDetails(aa){
        if(aa.t=1){    //个人用户
            window.open("/money.html");
        }else if(aa.t==2){   //企业用户
            if(aa.s==1){     //状态正常
                window.open("/showEnterprise.html");
            }else if(aa.s==2){  // 为未填写实名状态
                window.open("/showEnterprise.html");
            }else if(aa.s==3){    //实名信息正在审核
                window.open("/showEnterprise.html");
            }else if(aa.s==4){     //实名信息审核未通过
                window.open("/showEnterprise.html");
            }else if(aa.s==5){     //邮箱链接未确认状态
                window.open("/showEnterprise.html");
            }
        }
        shopping.setAttribute("value","登录");
    }
    /*跳转个人注册*/
    function  toRegViewOrCheckPhone(){
        var  flag=$("#userButton").val();
        if(flag="个人注册"){
            location.href="/regUI/jQuery-verify20160304/index.html";
        }else if(flag="短信验证"){
            location.href="/regUI/jQuery-verify20160304/checkPhone.html";
        }
    }
    /*跳转企业注册*/
    function  toEnterRegViewOrCheckFace(){
        var  flag=$("#enterButton").val();
        if(flag="企业注册"){
            location.href="/regUI/jQuery-enter/index.html";
        }else if(flag="人脸识别"){
            location.href="/checkFace.html";
        }
    }

</script>
</body>
<!-- //Body -->

</html>